<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
  <title>Document</title>
  <style>

  </style>
</head>
<body>

</body>
<script>
    let p = new Promise((resolve, reject) => {
      resolve(1) // 调用resolve，表示状态固定了，结果也就固定了
      reject(2) // 无效
      resolve(3) // 无效
      setTimeout(() => {
        resolve(4) // 无效
      }, 1000)
    })

    p.then(res => {
      console.log(res)
    }).catch(err => {
      console.log(err)
    })
</script>
</html>